08.a - Environment-Variables
Relevant source files
This page documents all environment variables required to configure and run the godeep.wiki application. Environment variables control authentication, payment processing, notifications, and application behavior. For instructions on deploying these variables to production, see Deployment Guide. For details on how to obtain GitHub App credentials, see GitHub App Configuration.
OverviewLink copied!
The application uses environment variables for:
- GitHub App authentication (both user OAuth and owner installation tokens)
- Stripe payment processing (checkout sessions and webhook verification)
- Admin panel access (password-based authentication)
- Event notifications (ntfy.sh message broker)
- Analytics integration (optional Cloudflare monitoring)
Environment variables are loaded from .env files during development and configured in the hosting platform (Vercel) for production deployments. The .env.example file provides a template showing all required variables.
Sources: .env.example L1-L15
Environment Variable CategoriesLink copied!
The following diagram shows how environment variables are organized by system component and their usage throughout the application:
Environment Variable Distribution Across System Components
Sources: .env.example L1-L15
GitHub App VariablesLink copied!
These variables configure the GitHub App integration that enables both user OAuth authentication and owner repository access via installation tokens.
Core GitHub App IdentifiersLink copied!
| Variable | Required | Purpose | Where Used |
|---|---|---|---|
GITHUB_APP_SLUG | Yes | GitHub App slug for installation URL construction | api/auth/github |
GITHUB_APP_ID | Yes | Numeric GitHub App ID for JWT creation | lib/github-app.ts |
GITHUB_CLIENT_ID | Yes | OAuth client ID for user authentication | api/auth/github |
GITHUB_CLIENT_SECRET | Yes | OAuth client secret for token exchange | api/auth/github/callback |
GITHUB_APP_SLUG
The slug appears in the GitHub App installation URL: https://github.com/apps/{GITHUB_APP_SLUG}/installations/new. This variable is used to construct the OAuth redirect URL that initiates the GitHub App installation flow.
Example value: godeepwiki-github-integration
GITHUB_APP_ID
The numeric identifier for your GitHub App, found in the app settings under "About". This ID is used to create GitHub App JWTs when generating installation access tokens, which allow the owner to access customer repositories.
Example value: 123456
GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET
These OAuth credentials enable user authentication and are used during the OAuth code exchange to obtain user access tokens. The client ID is embedded in OAuth URLs, while the client secret is used server-side to exchange authorization codes for access tokens.
Example client ID: Iv1.abc123def456
Sources: .env.example L1-L4
GitHub App Private KeyLink copied!
| Variable | Required | Purpose | Where Used |
|---|---|---|---|
GITHUB_PRIVATE_KEY | Yes | PEM-formatted private key for GitHub App JWT signing | lib/github-app.ts |
The private key is used to sign JWTs that authenticate as the GitHub App itself. This enables the generation of installation access tokens, which are required for the owner to clone and access customer repositories.
Format Requirements:
- PEM format (begins with
-----BEGIN RSA PRIVATE KEY-----) - Can be stored as multiline string in Vercel
- For single-line
.envfiles, base64 encode:cat key.pem | base64
How to Obtain:
- Navigate to your GitHub App settings
- Scroll to "Private keys" section
- Click "Generate a private key"
- Download the
.pemfile - Copy contents to environment variable (preserve newlines in Vercel)
Sources: .env.example L5
GitHub Webhook SecretLink copied!
| Variable | Required | Purpose | Where Used |
|---|---|---|---|
GITHUB_WEBHOOK_SECRET | Optional | Secret for verifying webhook signatures | api/webhooks/github |
This secret enables signature verification for GitHub webhook events, providing an additional logging mechanism for installation tracking. While optional, it's recommended for redundant event capture.
How to Generate:
openssl rand -hex 32
Save the generated value to both your .env file and your GitHub App webhook configuration.
Sources: .env.example L6
Stripe Payment VariablesLink copied!
These variables configure Stripe integration for payment processing and webhook verification.
Stripe API KeysLink copied!
| Variable | Required | Purpose | Where Used |
|---|---|---|---|
STRIPE_SECRET_KEY | Yes | Server-side Stripe API key for checkout session creation | app/actions.ts |
STRIPE_PUBLISHABLE_KEY | Yes | Server-side publishable key (legacy, for reference) | - |
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY | Yes | Client-accessible publishable key | app/actions.ts |
STRIPE_WEBHOOK_SECRET | Yes | Webhook signature verification secret | api/webhooks/stripe |
STRIPE_MCP_KEY | Optional | Additional Stripe integration key | - |
Key Types and Usage:
The diagram below shows how different Stripe keys are used throughout the payment flow:
Stripe Key Usage in Payment Flow
STRIPE_SECRET_KEY
Server-side secret key used to create checkout sessions via the Stripe API. This key must never be exposed to the client. Format: sk_live_... (production) or sk_test_... (testing).
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
Client-accessible publishable key used in the checkout session creation flow. This key is safe to expose in client-side code. Format: pk_live_... (production) or pk_test_... (testing).
STRIPE_WEBHOOK_SECRET
Secret used to verify webhook signatures from Stripe. This ensures that webhook events are authentic and originate from Stripe. Format: whsec_...
How to Obtain:
- Navigate to Stripe Dashboard → Developers → API keys
- Copy "Publishable key" and "Secret key"
- For webhook secret: Developers → Webhooks → Add endpoint
- Set endpoint URL to
https://your-domain.com/api/webhooks/stripe - Select event type:
checkout.session.completed - Copy the signing secret after creation
Sources: .env.example L9-L13
Application Configuration VariablesLink copied!
These variables control application-level behavior and authentication.
Base URL ConfigurationLink copied!
| Variable | Required | Purpose | Where Used |
|---|---|---|---|
NEXT_PUBLIC_APP_URL | Yes | Base URL for OAuth callbacks and redirects | api/auth/github app/actions.ts |
This variable defines the application's base URL and is used to construct OAuth callback URLs and Stripe redirect URLs. It must match your deployment URL exactly.
Example values:
- Development:
http://localhost:3000 - Production:
https://godeep.wiki
Critical Usage:
- OAuth callback URL construction:
${NEXT_PUBLIC_APP_URL}/api/auth/github/callback - Stripe success URL:
${NEXT_PUBLIC_APP_URL}/success?session_id={CHECKOUT_SESSION_ID}
Sources: .env.example L7
Admin Panel AuthenticationLink copied!
| Variable | Required | Purpose | Where Used |
|---|---|---|---|
NEXT_PUBLIC_ADMIN_PASSWORD | Yes | Password for admin panel access | admin api/admin/generate-token automation scripts |
This password protects the admin panel at /admin, which is used to generate installation access tokens for accessing customer repositories.
Security Consideration: The NEXT_PUBLIC_ prefix makes this variable accessible to client-side code, which is unusual for sensitive credentials. The system uses a simple password-based authentication model suitable for single-owner operation, not enterprise-grade security. Consider this when choosing the password value.
Usage Flow:
- Owner navigates to
/admin - Enters password (verified client-side and server-side)
- Session stored in
localStorage - Password also used by automation scripts to call token generation API
Sources: .env.example L8
Notification System VariablesLink copied!
| Variable | Required | Purpose | Where Used |
|---|---|---|---|
NTFY_TOPIC | Yes | ntfy.sh topic name for event notifications | api/webhooks/stripe api/auth/github/callback automation scripts |
The ntfy.sh topic serves as a message broker between payment/installation events and the automation scripts that clone repositories. This enables event-driven automation without requiring a database or message queue service.
Topic Structure:
The topic name should be unique to prevent unauthorized access. Example: godeep-wiki-payments or klaudioz-codex-alerts-2024.
Event Flow:
Notification Payload Example:
{ "title": "GitHub Connected", "message": "Installation: 12345678, Match ID: abc123...", "tags": ["white_check_mark"]}
The automation scripts subscribe to this topic and trigger repository cloning when notifications arrive.
Sources: .env.example L14
Optional VariablesLink copied!
Cloudflare AnalyticsLink copied!
| Variable | Required | Purpose | Where Used |
|---|---|---|---|
NEXT_PUBLIC_CF_BEACON_TOKEN | No | Cloudflare Web Analytics beacon token | app/layout.tsx |
Enables Cloudflare Web Analytics for privacy-focused visitor tracking without cookies. If omitted, no analytics tracking is enabled.
How to Obtain:
- Create Cloudflare account
- Navigate to Web Analytics
- Add a site
- Copy the beacon token
Sources: .env.example L15
Environment Variable Security ModelLink copied!
The following diagram illustrates the security characteristics of different environment variable categories:
Security Model for Environment Variables
Security Best PracticesLink copied!
Server-Side Variables:
- Store securely in Vercel environment (not in
.envcommitted to git) - Rotate secrets regularly (especially after team changes)
- Use separate keys for development/staging/production
Client-Accessible Variables:
- Only use
NEXT_PUBLIC_prefix for truly public values - Never include secrets or API keys in public variables
- Understand these values are visible in browser DevTools
Admin Password:
- Choose a strong, unique password (20+ characters recommended)
- Do not reuse passwords from other services
- Consider implementing IP allowlisting for
/adminin production - Be aware this is not suitable for multi-user scenarios
Sources: CLAUDE.md L110-L122
Configuration ExamplesLink copied!
Development Environment (.env file)Link copied!
# GitHub App ConfigurationGITHUB_APP_SLUG=godeepwiki-github-integrationGITHUB_APP_ID=123456GITHUB_CLIENT_ID=Iv1.abc123def456GITHUB_CLIENT_SECRET=abc123def456xyz789GITHUB_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----MIIEpAIBAAKCAQEA...-----END RSA PRIVATE KEY-----"GITHUB_WEBHOOK_SECRET=abc123def456xyz789abc123def456xyz789abc123def456xyz789abc123def4# Application SettingsNEXT_PUBLIC_APP_URL=http://localhost:3000NEXT_PUBLIC_ADMIN_PASSWORD=your-secure-admin-password-here# Stripe Configuration (Test Mode)STRIPE_PUBLISHABLE_KEY=pk_test_abc123NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_abc123STRIPE_SECRET_KEY=sk_test_xyz789STRIPE_WEBHOOK_SECRET=whsec_test123# Notification SystemNTFY_TOPIC=godeep-wiki-payments-dev# Optional AnalyticsNEXT_PUBLIC_CF_BEACON_TOKEN=
Production Environment (Vercel)Link copied!
For production deployment, configure environment variables in the Vercel dashboard:
- Navigate to Project Settings → Environment Variables
- Add each variable with appropriate scope (Production/Preview/Development)
- Use multiline text for
GITHUB_PRIVATE_KEY(preserve newlines) - Mark sensitive variables as "Encrypted" in Vercel
Vercel CLI Configuration:
vercel env add GITHUB_CLIENT_SECRET productionvercel env add STRIPE_SECRET_KEY productionvercel env add GITHUB_PRIVATE_KEY production
Sources: README.md L276-L289
Automation Script ConfigurationLink copied!
The automation scripts (ntfy-godeep-automation.sh and ntfy-godeep-automation-remote.sh) require specific environment variables to be set in the shell environment where they run:
Required Variables:
export ADMIN_PASSWORD="your-secure-admin-password"export NTFY_TOPIC="godeep-wiki-payments"export APP_URL="https://godeep.wiki"
These scripts subscribe to the ntfy.sh topic and use the admin password to authenticate with the token generation API when processing notifications.
Sources: Inferred from architecture diagrams and system design
Variable ValidationLink copied!
The application performs basic validation on environment variables at startup. Missing required variables will cause build failures or runtime errors:
Critical Variables Checked:
GITHUB_CLIENT_ID- Required for OAuth initializationGITHUB_CLIENT_SECRET- Required for token exchangeGITHUB_APP_ID- Required for installation token generationGITHUB_PRIVATE_KEY- Required for JWT signingSTRIPE_SECRET_KEY- Required for checkout session creationNEXT_PUBLIC_APP_URL- Required for OAuth callback URL construction
Validation Locations:
- OAuth endpoints validate GitHub credentials: api/auth/github api/auth/github/callback
- Payment action validates Stripe credentials: app/actions.ts
- Admin API validates GitHub App credentials: api/admin/generate-token
Sources: Inferred from code structure and error handling patterns
For information on how to obtain GitHub App credentials, see GitHub App Configuration. For deployment instructions and how to configure these variables in production, see Deployment Guide.
Refresh this wiki
Last indexed: 23 November 2025 (922b35)
On this page
- Environment Variables
- Overview
- Environment Variable Categories
- GitHub App Variables
- Core GitHub App Identifiers
- GitHub App Private Key
- GitHub Webhook Secret
- Stripe Payment Variables
- Stripe API Keys
- Application Configuration Variables
- Base URL Configuration
- Admin Panel Authentication
- Notification System Variables
- Optional Variables
- Cloudflare Analytics
- Environment Variable Security Model
- Security Best Practices
- Configuration Examples
- Development Environment (.env file)
- Production Environment (Vercel)
- Automation Script Configuration
- Variable Validation
Ask Devin about godeep.wiki-jb
Syntax error in text
mermaid version 11.4.1